set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set(KVCACHE_PUBLISHER_SOURCES
    src/KVCachePublisher.cpp
)

# 如果DYNAMO标志被设置为1，添加DynamoPublisher.cpp
if(DYNAMO)
    list(APPEND KVCACHE_PUBLISHER_SOURCES src/DynamoPublisher.cpp)
    message(STATUS "Building with Dynamo support")
else()
    message(STATUS "Building without Dynamo support")
endif()

# 创建静态库
add_library(kvcache_publisher STATIC
    ${KVCACHE_PUBLISHER_SOURCES}
)

# 公开头文件目录
target_include_directories(kvcache_publisher PUBLIC
    include
    ${SRC_DIR}/include
    ${ROOT_DIR}/kvcache-memorypool/include
    ${COMMON_DIR}/include
)

if(DYNAMO)
    add_dependencies(kvcache_publisher build_dynamo)
    target_link_libraries(kvcache_publisher PUBLIC dynamo_adapter_interface)
endif()
